Skip to main content

Theta

The Theta model is a forecasting technique that combines a simple exponential smoothing approach with a linear trend component. It is useful for forecasting time series data that exhibits a linear trend.

The Theta model is based on the assumption that the future values of a time series can be estimated by applying exponential smoothing to the linearly detrended data. It is named after the Greek letter theta (θ), which represents the slope of the trend line.

The Theta model provides a simple and straightforward approach to forecasting time series data with a linear trend. However, it assumes that the trend remains linear over the forecasted period and may not capture more complex trend patterns. Additionally, it may not perform well for time series with irregular or nonlinear trends.

Method: POST Authorization: API Key
https://engine.raccoon-ai.io/api/v1/ml/time-series/theta

Authorization

TypeKeyValue
API KeyX-Api-Keyrae_######

Request Body

SectionKeyData TypeRequiredDescription
traindatajsontrueData that use to train the model
date_colstringtrueInput features (X)
target_colstringtrueOutput targets (y)
configfreqstringfalseGap between datas/ time
test_sizefloatfalseTest size for split data
forcastforcast_forinttrueNumber of points that need to forcast

Types

{
"train": {
"data": <json>,
"dates_col": <string>,
"target_col": <string>
},
"config": {
"freq": <string>,
"test_size": <float>
},
"forcast_for": <int>
}

Sample

{
"train": {
"data": {
"dates": {
"0": "2022-11-25",
"1": "2022-12-02",
"2": "2022-12-09",
"3": "2022-12-16",
"4": "2022-12-23",
"5": "2022-12-30",
"6": "2023-01-06",
"7": "2023-01-13",
"8": "2023-01-20",
"9": "2023-01-27"
},
"marks": {
"0": 161,
"1": 123,
"2": 134,
"3": 167,
"4": 143,
"5": 156,
"6": 167,
"7": 143,
"8": 156,
"9": 167
}
},
"dates_col": "dates",
"target_col": "marks"
},
"config": {
"freq": "W",
"test_size": 0.25
},
"forcast_for": 5
}

Reponse Body

KeyData TypeDescription
successbooleanIndicate the success of the request
msgstringMessage indicators
errorstringError information, only set if success is false
resultjsonResult, only set if success is true
scorejsonr2_scores of the training and testing phases, only set if success is true
generated_tsfloatGenerated timestamp

Types

{
"success": <boolean>,
"msg": <string | null>,
"error": <string | null>,
"result": <list>,
"score": {
"rmse": <float>
},
"generated_ts": <timestamp>
}

Sample

{
"success": true,
"msg": "Model trained and predicted successfully",
"error": null,
"result": [
145.306460384454, 159.01596373700463, 165.26655276778865,
144.69950483108218, 160.2060306291415
],
"score": {
"rmse": 14.027130973766175
},
"generated_ts": 1685514898.064395
}